<?php
class GoodsModel extends MongoModel{
	var $table ='goods';
	var $name = '商品';
	
	public static $VALUE_TYPE = array(
		'status' 		=> 'int',
		'ems' 			=> 'float',
		'express'		=> 'float',
		'post' 			=> 'float',
		'price' 		=> 'float',
		'market_price'	=> 'float',
		'max' 			=> 'int',
		'min' 			=> 'int',
		'stock'			=> 'int',
		'goods_flag' 	=> 'int'
	);
	
	/**
	 * 上架
	 * @var int
	 */
	const STATUS_ON_SALE = 1;
	
	/**
	 * 下架
	 * @var int
	 */
	const STATUS_OFF_SALE = -1;
	
	public static function getStatusOpts($has_null=false, $null_text='--不限制--'){
		$opts = array();
		if($has_null){
			$opts[''] = $null_text;
		}
		$opts[self::STATUS_ON_SALE] = '上架';
		$opts[self::STATUS_OFF_SALE] = '下架';
		return $opts;
	}
	
	public static function getUrl($goods){
		return '/goods/' . $goods['_id'] . '.html';
	}
}

?>